There was some confusion between unflipped and flipped positions.
Both final_position and current_position are meant to be unflipped,
and get_effective_position() needs to be applied to them to get
a flipped position. _gtk_window_set_popover_position() also expects
an unflipped position.
https://bugzilla.gnome.org/show_bug.cgi?id=735014
GtkRequisition req;
GtkPositionType pos;
gint overshoot[4];
- gint i;
+ gint i, j;
gint best;
if (!priv->window)
if (overshoot[pos] <= 0)
{
- priv->final_position = pos;
+ priv->final_position = priv->preferred_position;
}
else if (overshoot[opposite_position (pos)] <= 0)
{
- priv->final_position = opposite_position (pos);
+ priv->final_position = opposite_position (priv->preferred_position);
}
else
{
pos = 0;
for (i = 0; i < 4; i++)
{
- if (overshoot[i] < best)
+ j = get_effective_position (popover, i);
+ if (overshoot[j] < best)
{
pos = i;
- best = overshoot[i];
+ best = overshoot[j];
}
}
priv->final_position = pos;